package edu.uclm.esi.tysw.tusEntradas.persistence;

import java.sql.SQLException;

public class Broker {
	protected static Broker instancia=null;
	protected int id;

	protected Broker() throws SQLException {
        try {
        	Class.forName("com.mysql.jdbc.Driver");
        	this.id=1;
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	public static Broker get() throws SQLException {
		if (Broker.instancia==null) 
			instancia=new Broker();
		return instancia;
	}
	
	public Conexion getBD() throws SQLException {
		Conexion result=new Conexion(id++);
		return result;
	}

	public Conexion getBD(String email, String pwd) throws SQLException {
		Conexion result=new Conexion(id++, email, pwd);
		return result;
	}
}
